import json
import os

from tpshop_auto.config.config import BASE_DIR


# 读取json工具
def read_json(filename, key):
    file_path = BASE_DIR + os.sep + "data" + os.sep + filename
    arrs = []
    with open(file_path, "r", encoding="utf-8")as f:
        for data in json.load(f).get(key):
            arrs.append(tuple(data.values())[1:])
        return arrs


def write_json(value):
    file_path = BASE_DIR + os.sep + "data" + os.sep + "expect.json"
    with open(file_path,"w",encoding="utf-8")as f:
        data = {"expect":[{"desc":"app订单编号","order_no":value}]}
        json.dump(data,f)

if __name__ == '__main__':
    print(read_json("app_order.json", "order"))